package bs.service.impl;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.stereotype.Service;

import bs.dao.ArticalDao;
import bs.entity.Artical;
import bs.service.ArticalService;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;

/**
 * 
 * ArticalServiceImpl
 *
 * @author 姜治昊
 * @time 2017年11月23日 下午9:23:43
 */
@Service
public class ArticalServiceImpl implements ArticalService{

	@Autowired
	private ArticalDao articalDao;
	
	/**
	 * 获取热门文章
	 */
	@Override
	@Cacheable(cacheNames="freeCache")
	public PageInfo<Artical> getHotArticals(int page, int rows) {
		PageHelper.startPage(page, rows);
		PageInfo<Artical> pageInfo = new PageInfo<Artical>(articalDao.getHotArticals()); 
		return pageInfo;
	}
	
}
